<!DOCTYPE html>
<html lang="en">
<head>
    <title>考勤列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <script src="https://file.ggxqce.com/web/vue.min.js"></script>

    <style>
        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            font-size: 12px;
        }

        body {
            margin: 1px;
            background: #f8f8f8;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            display: table;
        }

        table.text-center, table.text-center td, table.text-center th {
            text-align: center;
            font-size: 12px;
        }

        .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
            border: 1px solid #cbcbcd;
            font-weight: normal;
            height: 24px;
        }

        table th {
            background: #f8f8f8;
        }
        .table-bordered {
            border: 1px solid #cbcbcd;
        }

        .table {
            width: 100%;
            max-width: 100%;
        }

        .hidden {
            display: none;
        }
        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 24px;
            line-height: 24px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }
        .mScrollBox {
            float: left;
            position: relative;
            overflow: hidden;
        }
        .infoReport{
            text-align: center;
            margin: 0;
            margin-bottom: 10px;
        }
        .moduleName{
            height: 20px;
            line-height: 20px;
            background: #f8f8f8;
            font-weight: bold;
            font-size: 14px;
        }
        .oaReportNav{
            position: relative;
        }
        .toggleDiv{
            height: 20px;
            line-height: 20px;
            margin-bottom: 10px;
        }
        .toggleDiv div{
            width: 50%;
            float: left;
            text-align: center;
        }
        .toggleDiv div.active{
            border-bottom: 2px solid #2289ee;
        }
        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }
        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div style="padding: 10px 0;background: #fff;overflow: hidden" id="signInBigRegion">
        <div  style="width: 100%;" class="mScrollBox">

            <table class="table table-bordered text-center table-width " >
                <thead>
                <tr>
                    <th style="width: 15%;">岗位</th>
                    <th style="width: 12%;">姓名</th>
                    <!--<th style="width: 20%;">日期</th>-->
                    <th style="width: 10%;">出勤</th>
                    <th style="width: 13%;" v-if="dateTime==today">签到时间</th>
                    <th style="width: 20%;" v-if="dateTime==today">签到地点/<br>请假原因</th>
                    <th style="width: 10%;" v-if="dateTime==today">签退时间</th>
                    <th style="width: 10%;" v-if="dateTime==today">签退地点</th>
                    <th style="width: 20%;">区域</th>
                </tr>
                </thead>
                <tbody>
                <tr v-for="(item,i) in sign.list">
                    <td>{{item.roleName}}</td>
                    <td>{{item.userName}}</td>
                    <!--<td>{{item.signDate}}</td>-->
                    <td>
                            <span v-if="item.signState=='0'">
                                <span v-if="sign.info.entryDate==item.signDate">入职</span>
                                <img style="width: 18px;" src="/dist/img/ic_app_right.png" v-else>
                                <!--<i class="fa fa-check" style="color:#349f2f;" v-else></i>-->
                            </span>
                        <span v-else-if="item.signState==1">
                            请假
                        </span>
                        <span v-else>
                                <!--<i class="fa fa-close" style="color:red;"></i>-->
                            <img style="width: 18px;" src="/dist/img/ic_app_worng.png">
                            </span>
                    </td>
                    <td v-if="dateTime==today">
                        {{item.signCreateTime==" 00:00"?"-":item.signCreateTime}}
                    </td>
                    <td style="text-align: left;" class="lineOne" v-if="dateTime==today">
                        <span v-if="item.signState=='0'" @click="openImg(item.signUrl)"
                              style="color:#228bee;cursor: pointer;">{{item.startAddress}}</span>
                        <span v-else-if="item.signState==1">{{item.startAddress}}</span>
                    </td>
                    <td v-if="dateTime==today">
                        {{item.signOutTime}}
                    </td>
                    <td style="text-align: left;color:#228bee;cursor: pointer;" class="lineOne" v-if="dateTime==today">
                        <span v-if="item.endAddress" @click="openImg(item.signOutUrl)">{{item.endAddress}}</span>
                    </td>
                    <td class="lineOne">
                        <span>{{item.regionName}}</span>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <!-- /.box-body -->
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>

<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            type1: getCurrentUser().type1,
            type2: getCurrentUser().type2,
            typeId:getCurrentUser().typeId,
            dateTime: getCurrentUser().dateTime,
            yesterday:new Date(new Date()-24*60*60*1000).Format("yyyy-MM-dd"),
            today: new Date().Format("yyyy-MM-dd"),//今天
            hour:new Date().getHours(),
            thisMonth: new Date().Format("yyyy-MM"),
            thisWeek: new Date().Format("yyyy-MM-dd") + "-w",
            tab:[],
            sign: {
                list: [],
                info:{}
            },
        },
        methods: {
            //获取tab
            openImg:function (url) {
                var obj = {
                    type: 'img',
                    imgList: url,
                }
                prompt(JSON.stringify(obj))
//                if(url){
//                    html="<image class='imgStyle' src="+url+">"
//                }else{
//                    html="未上传照片！"
//                }
//
//                $.dialog({
//                    content:html,
//                    title: '签到详情',
//                    width: 100,
//                    height: 200,
//                    max: false,
//                    min: false,
//                    lock: true
//                });
            },
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //获取签到报表-区域经理
            get_signInList: function () {
                var that = this;
                var data={};
                if(that.type1=="company") {
                    data = {
                        "companyId": that.typeId,
                        "type": that.type2,
                        "dateTime":that.dateTime
                    }
                }else{
                    data={
                        "departId": that.typeId,
                        "type": that.type2,
                        "dateTime":that.dateTime
                    }
                }
                $.wyui.postMethod(urlConfig.report.attendance.getForSignInByTypeAndDateTime, data, function (data) {
                    console.log(data);
                    that.sign.list = data;
                }, false,"#signInBigRegion");
            }
        },
        mounted: function () {
            var that = this;
            //1.获取前5个月的tab数据
            this.get_signInList();
        }
    });
</script>

</body>
</html>